package com.yang.train.member.controller;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 缘友一世
 * date 2024-04-23-8:15
 */
@RestController
@RefreshScope
public class TestController {
    @Value("${nacos.test}")
    private String testNacos;
    @Resource
    Environment environment;
    @GetMapping("/hello")
    public String hello() {
        String port = environment.getProperty("local.server.port");
        return String.format("Hello %s! 端口：%s", testNacos, port);
    }
}
